package com.snowy.hidden.constant;

import lombok.Getter;

import java.util.Arrays;

/**
 * <p>
 *故障设备
 * </p>
 *
 * @author：Lei.y
 * @date：2022/5/11 15:42
 */
@Getter
public enum FaultReasonEnum {
    ph("1","第三方破坏"),
    lh("2","老化"),

    fd("3","封堵"),
    yw("4","异物"),
    tq("5","恶劣天气"),
    td("6","通道"),

    ;


    private String code;
    private String desc;

    FaultReasonEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    /**
     * 通过code获取枚举
     *
     * @param code
     * @return
     */
    public static FaultReasonEnum getEnum(String code) {
        return Arrays.stream(FaultReasonEnum.values()).filter(item -> item.getCode().equals(code)).findFirst().get();
    }
}
